﻿using MES.Core;
using MES.Model.System;
using MES.Service.System.UserRole;
using Microsoft.AspNetCore.Mvc;

namespace MES.API.Controllers.System
{
    /// <summary>
    /// 用户角色管理
    /// </summary>
    [ApiVersion("1.0", Deprecated = false)]
    [Route("api/[controller]/[Action]")]
    [ApiController]
    public class UserRoleController : ControllerBase
    {

        private readonly IUserRoleService _userRoleService;
        public UserRoleController(IUserRoleService userRoleService)
        {
            _userRoleService = userRoleService;
        }

        /// <summary>
        /// 添加用户角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<OperateResult> AddRolePermissionAsync([FromBody] SyS_UserRole role)
        {
            return await _userRoleService.AddRolePermissionAsync(role);
        }
    }
}
